<?php
/**
* @file $Id: DrawTab.fnc.php 437 2007-04-23 00:57:51Z focus-sis $
* @package Focus/SIS
* @copyright Copyright (C) 2006 Andrew Schmadeke. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* Focus/SIS is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.txt for copyright notices and details.
*/

function DrawTab($title,$link='',$tabcolor='333366',$textcolor='FFFFFF',$type='',$rollover='',$extra='')
{	global $_FOCUS;
	if(substr($title,0,1)!='<')
		$title = ereg_replace(" ","&nbsp;",$title);

	if($tabcolor=='333366')
	{
		$tabcolor = Preferences('HIGHLIGHT');
		if($type=='')
			$type = '_selected';
	}

	$block_table .= "<table border=0 cellspacing=0 cellpadding=0 ".$extra.">";
	$block_table .= "  <tr style='background-color:#$tabcolor' id=tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]>";
	if($_FOCUS['direction']=='RTL')
		$block_table .= "    <td height=14><IMG SRC=assets/right_corner$type.gif border=0></td><td height=14 class=\"BoxHeading\" valign=middle align=center>";
	else
	$block_table .= "    <td height=14><IMG SRC=assets/left_corner$type.gif border=0></td><td height=14 class=\"BoxHeading\" valign=middle align=center>";
	if($link)
	{
		if(is_array($rollover))
			$rollover = " onmouseover=\"document.getElementById('tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.backgroundColor='#".$rollover['tabcolor']."';document.getElementById('tab_link[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.color='#".$rollover['textcolor']."';\" onmouseout=\"document.getElementById('tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.backgroundColor='#$tabcolor';document.getElementById('tab_link[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.color='#".$textcolor."';\" ";
		if(!isset($_REQUEST['_FOCUS_PDF']))
			$block_table .= "<A HREF=$link class=BoxHeading style='color:#$textcolor' $rollover id=tab_link[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]>$title</A>";
		else
			$block_table .= "<font color=#$textcolor face=Verdana,Arial,sans-serif size=-2><b>$title</b></font>";			
	}
	else
	{
		if(!isset($_REQUEST['_FOCUS_PDF']))
			$block_table .= "<font color=#$textcolor>" . $title . "</font>";
		else
			$block_table .= "<font color=#$textcolor face=Verdana,Arial,sans-serif size=-2><b>" . $title . "</b></font>";			
	}
	
	if($_FOCUS['direction']=='RTL')
		$block_table .= "</td><td height=14 align=".ALIGN_RIGHT."><IMG SRC=assets/left_corner$type.gif class=directed border=0></td>";
	else
		$block_table .= "</td><td height=14 align=".ALIGN_RIGHT."><IMG SRC=assets/right_corner$type.gif class=directed border=0></td>";
	
	$block_table .= "  </tr>";
	$block_table .= "</table>\n";
	return $block_table;
}

function DrawRoundedRect($title,$link='',$tabcolor='333366',$textcolor='FFFFFF',$type='',$rollover='')
{
	if(substr($title,0,1)!='<')
		$title = ereg_replace(" ","&nbsp;",$title);

	if($tabcolor=='333366')
	{
		$tabcolor = Preferences('HIGHLIGHT');
	}

	$block_table .= "<table border=0 cellspacing=0 cellpadding=0>";
	$block_table .= "  <tr style='background-color:#$tabcolor' id=tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]>";
	$block_table .= "    <td height=5 width=5 valign=top><IMG SRC=assets/left_upper_corner.gif border=0></td><td rowspan=3 class=\"BoxHeading\" valign=middle>";
	if($link)
	{
		if(is_array($rollover))
			$rollover = " onmouseover=\"document.getElementById('tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.backgroundColor='#".$rollover['tabcolor']."';document.getElementById('tab_link[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.color='#".$rollover['textcolor']."';\" onmouseout=\"document.getElementById('tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.backgroundColor='#$tabcolor';document.getElementById('tab_link[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]').style.color='#".$textcolor."';\" ";
		if(!isset($_REQUEST['_FOCUS_PDF']))
			$block_table .= "<A HREF=$link class=BoxHeading style='color:#$textcolor' $rollover id=tab_link[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]>$title</A>";
		else
			$block_table .= "<font color=#$textcolor face=Verdana,Arial,sans-serif size=-2><b>$title</b></font>";			
	}
	else
	{
		if(!isset($_REQUEST['_FOCUS_PDF']))
			$block_table .= "<font color=#$textcolor>" . $title . "</font>";
		else
			$block_table .= "<font color=#$textcolor face=Verdana,Arial,sans-serif size=-2><b>" . $title . "</b></font>";			
	}
	$block_table .= "</td><td height=5 width=5 valign=top><IMG SRC=assets/right_upper_corner.gif border=0></td>";
	$block_table .= "  </tr>";

	// MIDDLE ROW
	$block_table .= "  <tr style='background-color:#$tabcolor' id=tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]>";
	$block_table .= "    <td width=5>&nbsp;</td>";
	$block_table .= "<td width=5>&nbsp;</td>";
	$block_table .= "  </tr>";

	
	// BOTTOM ROW
	$block_table .= "  <tr style='background-color:#$tabcolor' id=tab[".ereg_replace('[^a-zA-Z0-9+=*/.()-]','_',$link)."]>";
	$block_table .= "    <td height=5 width=5 valign=bottom><IMG SRC=assets/left_lower_corner.gif border=0></td>";
	$block_table .= "<td height=5 width=5 valign=bottom><IMG SRC=assets/right_lower_corner.gif border=0></td>";
	$block_table .= "  </tr>";


	
	$block_table .= "</table>\n";
	return $block_table;
}
?>
